
*********************************************************
*********************************************************
******* Data on The Sample					  *******
*********************************************************
*********************************************************


use Data_OriginsandRights_220927.dta, clear
codebook country, compact
codebook country if year ==2010, compact

browse country year if year ==2010
tab legor07 if year==2010



*********************************************************
*********************************************************
******* Figure 1: Number of Countries Over Time	  *******
*********************************************************
*********************************************************

use Data_OriginsandRights_220927.dta, clear

	   
collapse (sum) civil_law common_law, by(year)

 twoway (line common_law year,lcolor(red%50) lp(dash)) (line civil_law year, lcolor(blue%50)), ///
	ytitle("Number of Countries") ///
	xtitle("Year") ///
		title("") ///
	xsize(1) ysize(1)  xlabel(1950(10)2010) ///
	ylabel(0(20)140 ) scheme(s1mono) yscale(noextend) xscale(noextend) plotregion(style(none)) legend(label(1 "Common Law") label(2 "Civil Law") )


*********************************************************
*********************************************************
******* Figure 2: Mapping The Sample			  *******
*********************************************************
*********************************************************

// Adjust Map Data
use worlddata.dta, clear
replace ISO_A3 = "FRA" if SOVEREIGNT=="France"
replace ISO_A3 = "NOR" if SOVEREIGNT=="Norway"
replace ISO_A3 = "KOS" if SOVEREIGNT=="Kosovo"

drop if ADMIN=="New Caledonia"
drop if ADMIN=="French Southern and Antarctic Lands"
drop if ADMIN=="Somaliland"
drop if ADMIN=="Northern Cyprus"
ren ISO_A3 iso3c

save worlddata_edited.dta, replace

// Load Response Data


use Data_OriginsandRights_220927.dta, clear
drop if year !=2010


kountry code_cown, from(cown) to(iso3c)
rename _ISO3C_ iso3c

merge 1:1 iso3c using worlddata_edited.dta


drop if _merge==1
drop if NAME=="Antarctica"
* drop if _merge==2

// Create Response Variable 

gen origin1 =0
 replace origin1=1 if common_law==1
 replace origin1=2 if civil_law==1

tab origin1
 
// Draw Map 


spmap origin1 using worldcoor.dta if SOVEREIGNT!="Antarctica" & iso3c!="GRL", id(id) clm(custom) clb(0 0.9 1.9 2.9) graphregion(fcolor(white) color(white)) fcolor("white" "red%20" "blue%50") legtitle("") name(smallc, replace) legend(label(2 "Excluded") label(3 "Common Law") label(4 "Civil Law")  pos(8) symy(5) symx(5) textw(10) size(3))
	
	

*********************************************************
*********************************************************
******* Figure 3: Number of Rights Over Time 	   ******
*********************************************************
*********************************************************

***** Common Countries 

use Data_OriginsandRights_220927.dta, clear

collapse (mean) rights_mean = rights_total87 ///
         (p25) p25 = rights_total87 (p75) p75 = rights_total87 if common_law==1 , by(year)

		 twoway (rarea p25 p75 year, fcolor(red%30) lcolor(red%30)) (line rights_mean year), ///
	ytitle("Constitutional Rights") ///
	xtitle("Year") ///
		title("Common Law Countries") ///
	xsize(1) ysize(1) legend(off) xlabel(1950(10)2010) ///
	ylabel(0(10)60 ) scheme(s1mono) yscale(noextend) xscale(noextend) plotregion(style(none))

***** Civil Law Countries 

use Data_OriginsandRights_220927.dta, clear
	   
collapse (mean) rights_mean = rights_total87 ///
         (p25) p25 = rights_total87 (p75) p75 = rights_total87 if civil_law==1 , by(year)

twoway (rarea p25 p75 year, fcolor(blue%30) lcolor(blue%30)) (line rights_mean year), ///
	ytitle("Constitutional Rights") ///
	xtitle("Year") ///
		title("Civil Law Countries") ///
	xsize(1) ysize(1) legend(off) xlabel(1950(10)2010) ///
	ylabel(0(10)60 ) scheme(s1mono) yscale(noextend) xscale(noextend) plotregion(style(none))
	


*********************************************************
*********************************************************
******* Figure 4: Number of Treaties Over Time 	  *******
*********************************************************
*********************************************************

***** Common Countries 

use Data_OriginsandRights_220927.dta, clear


collapse (mean) rights_mean = treatiestotal ///
         (p25) p25 = treatiestotal (p75) p75 = treatiestotal if common_law==1 , by(year)

		 twoway (rarea p25 p75 year, fcolor(red%30) lcolor(red%30)) (line rights_mean year), ///
	ytitle("Human Rights Treaties") ///
	xtitle("Year") ///
		title("Common Law Countries") ///
	xsize(1) ysize(1) legend(off) xlabel(1950(10)2010) ///
	ylabel(0(1)6 ) scheme(s1mono) yscale(noextend) xscale(noextend) plotregion(style(none))
	
***** Civil Law Countries 

use Data_OriginsandRights_220927.dta, clear

collapse (mean) rights_mean = treatiestotal ///
         (p25) p25 = treatiestotal (p75) p75 = treatiestotal if civil_law==1 , by(year)

		 twoway (rarea p25 p75 year, fcolor(blue%30) lcolor(blue%30)) (line rights_mean year), ///
	ytitle("Human Rights Treaties") ///
	xtitle("Year") ///
		title("Civil Law Countries") ///
	xsize(1) ysize(1) legend(off) xlabel(1950(10)2010) ///
	ylabel(0(1)6 ) scheme(s1mono) yscale(noextend) xscale(noextend) plotregion(style(none))
	
	
		
*********************************************************
*********************************************************
******* Figure 5: Number of Duties Over Time 	  *******
*********************************************************
*********************************************************

***** Common Countries 

use Data_OriginsandRights_220927.dta, clear

collapse (mean) rights_mean = dutiestotal ///
         (p25) p25 = dutiestotal (p75) p75 = dutiestotal if common_law==1 , by(year)

		 twoway (rarea p25 p75 year, fcolor(red%30) lcolor(red%30)) (line rights_mean year), ///
	ytitle("Constitutional Duties") ///
	xtitle("Year") ///
		title("Common Law Countries") ///
	xsize(1) ysize(1) legend(off) xlabel(1950(10)2010) ///
	ylabel(0(1)8 ) scheme(s1mono) yscale(noextend) xscale(noextend) plotregion(style(none))
	
***** Civil Law Countries 

use Data_OriginsandRights_220927.dta, clear

collapse (mean) rights_mean = dutiestotal ///
         (p25) p25 = dutiestotal (p75) p75 = dutiestotal if civil_law==1 , by(year)

		 twoway (rarea p25 p75 year, fcolor(blue%30) lcolor(blue%30)) (line rights_mean year), ///
	ytitle("Constitutional Duties") ///
	xtitle("Year") ///
		title("Civil Law Countries") ///
	xsize(1) ysize(1) legend(off) xlabel(1950(10)2010) ///
	ylabel(0(1)8 ) scheme(s1mono) yscale(noextend) xscale(noextend) plotregion(style(none))
	



*********************************************************
*********************************************************
******* Figure 6: Treaty Status Over Time 	 	  *******
*********************************************************
*********************************************************

***** Common Countries 


use Data_OriginsandRights_220927.dta, clear

drop if treatstatus==.
codebook country if year ==2010, compact
tab civil_law if year ==2010
tab common_law if year ==2010

collapse (mean) rights_mean = treatstatus ///
         (p25) p25 = treatstatus (p75) p75 = treatstatus if common_law==1 , by(year)

		 twoway (line rights_mean year, lcolor(red)), ///
	ytitle("Share of Countries") ///
	xtitle("Year") ///
		title("Common Law Countries") ///
	xsize(1) ysize(1) legend(off) xlabel(1950(10)2010) ///
	ylabel(0(.1)1 ) scheme(s1mono) yscale(noextend) xscale(noextend) plotregion(style(none))
	
***** Civil Law Countries 

use Data_OriginsandRights_220927.dta, clear
drop if treatstatus==.
	   
collapse (mean) rights_mean = treatstatus ///
         (p25) p25 = treatstatus (p75) p75 = treatstatus if civil_law==1 , by(year)

		 twoway (line rights_mean year, lcolor(blue)), ///
	ytitle("Share of Countries") ///
	xtitle("Year") ///
		title("Civil Law Countries") ///
	xsize(1) ysize(1) legend(off) xlabel(1950(10)2010) ///
	ylabel(0(.1)1 ) scheme(s1mono) yscale(noextend) xscale(noextend) plotregion(style(none))
	




**************************************************************
**************************************************************
******* Figure 7: Treaties as Source of Small-c Right  *******
**************************************************************
**************************************************************

use Data_OriginsandRights_220927.dta, clear

drop if year!=2010
drop if sources_treaties==.
codebook country if year ==2010, compact
tab civil_law if year ==2010
tab common_law if year ==2010

**** Graphing 

gen civillaw="Common Law"
replace civillaw="Civil Law" if common_law==0

graph bar (mean) sources_treaties, over(civillaw, sort(1)) legend(region(lwidth(none))) graphregion(color(white)) bgcolor(white) bar(1,color(blue%20)) bar(2,color(blue%20)) ytitle("Share of Countries")


**** Numerical Totals


summarize sources_treaties if civillaw=="Common Law"
summarize sources_treaties if civillaw=="Civil Law"

		
	
	
	
	
	
	
	